home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 January: Mac OS SDK / Dev.CD Jan 00 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / QuickdrawText.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  9.9 KB  |  316 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        QuickdrawText.h
  3.  
  4.      Contains:    Quickdraw Text Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1983-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QUICKDRAWTEXT__
  19. #define __QUICKDRAWTEXT__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50. /* new CGrafPort bottleneck ("newProc2") function, used in Unicode Text drawing */
  51. EXTERN_API_C( OSStatus )
  52. StandardGlyphs                    (void *                    dataStream,
  53.                                  ByteCount                 size);
  54.  
  55.  
  56.  
  57. enum {
  58.                                                                 /* CharToPixel directions */
  59.     leftCaret                    = 0,                            /*Place caret for left block*/
  60.     rightCaret                    = -1,                            /*Place caret for right block*/
  61.     kHilite                        = 1,                            /*Direction is SysDirection*/
  62.     smLeftCaret                    = 0,                            /*Place caret for left block - obsolete */
  63.     smRightCaret                = -1,                            /*Place caret for right block - obsolete */
  64.     smHilite                    = 1                                /*Direction is TESysJust - obsolete */
  65. };
  66.  
  67.  
  68. enum {
  69.                                                                 /*Constants for styleRunPosition argument in PortionLine, DrawJustified, MeasureJustified, CharToPixel, and PixelToChar.*/
  70.     onlyStyleRun                = 0,                            /* This is the only style run on the line */
  71.     leftStyleRun                = 1,                            /* This is leftmost of multiple style runs on the line */
  72.     rightStyleRun                = 2,                            /* This is rightmost of multiple style runs on the line */
  73.     middleStyleRun                = 3,                            /* There are multiple style runs on the line and this is neither the leftmost nor the rightmost. */
  74.     smOnlyStyleRun                = 0,                            /* obsolete */
  75.     smLeftStyleRun                = 1,                            /* obsolete */
  76.     smRightStyleRun                = 2,                            /* obsolete */
  77.     smMiddleStyleRun            = 3                                /* obsolete */
  78. };
  79.  
  80. /* type for styleRunPosition parameter in PixelToChar etc. */
  81. typedef short                             JustStyleCode;
  82.  
  83. struct FontInfo {
  84.     short                             ascent;
  85.     short                             descent;
  86.     short                             widMax;
  87.     short                             leading;
  88. };
  89. typedef struct FontInfo                    FontInfo;
  90.  
  91. typedef short                             FormatOrder[1];
  92. typedef FormatOrder *                    FormatOrderPtr;
  93. /* FormatStatus was moved to TextUtils.i */
  94.  
  95. struct OffPair {
  96.     short                             offFirst;
  97.     short                             offSecond;
  98. };
  99. typedef struct OffPair                    OffPair;
  100.  
  101. typedef OffPair                         OffsetTable[3];
  102. typedef CALLBACK_API( Boolean , StyleRunDirectionProcPtr )(short styleRunIndex, void *dirParam);
  103. typedef STACK_UPP_TYPE(StyleRunDirectionProcPtr)                 StyleRunDirectionUPP;
  104. enum { uppStyleRunDirectionProcInfo = 0x00000390 };             /* pascal 1_byte Func(2_bytes, 4_bytes) */
  105. #define NewStyleRunDirectionProc(userRoutine)                     (StyleRunDirectionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppStyleRunDirectionProcInfo, GetCurrentArchitecture())
  106. #define CallStyleRunDirectionProc(userRoutine, styleRunIndex, dirParam)  CALL_TWO_PARAMETER_UPP((userRoutine), uppStyleRunDirectionProcInfo, (styleRunIndex), (dirParam))
  107. EXTERN_API( short )
  108. Pixel2Char                        (Ptr                     textBuf,
  109.                                  short                     textLen,
  110.                                  short                     slop,
  111.                                  short                     pixelWidth,
  112.                                  Boolean *                leadingEdge)                        FOURWORDINLINE(0x2F3C, 0x820E, 0x0014, 0xA8B5);
  113.  
  114. EXTERN_API( short )
  115. Char2Pixel                        (Ptr                     textBuf,
  116.                                  short                     textLen,
  117.                                  short                     slop,
  118.                                  short                     offset,
  119.                                  short                     direction)                            FOURWORDINLINE(0x2F3C, 0x820C, 0x0016, 0xA8B5);
  120.  
  121. EXTERN_API( short )
  122. PixelToChar                        (Ptr                     textBuf,
  123.                                  long                     textLength,
  124.                                  Fixed                     slop,
  125.                                  Fixed                     pixelWidth,
  126.                                  Boolean *                leadingEdge,
  127.                                  Fixed *                widthRemaining,
  128.                                  JustStyleCode             styleRunPosition,
  129.                                  Point                     numer,
  130.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8222, 0x002E, 0xA8B5);
  131.  
  132. EXTERN_API( short )
  133. CharToPixel                        (Ptr                     textBuf,
  134.                                  long                     textLength,
  135.                                  Fixed                     slop,
  136.                                  long                     offset,
  137.                                  short                     direction,
  138.                                  JustStyleCode             styleRunPosition,
  139.                                  Point                     numer,
  140.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x821C, 0x0030, 0xA8B5);
  141.  
  142. EXTERN_API( void )
  143. DrawJustified                    (Ptr                     textPtr,
  144.                                  long                     textLength,
  145.                                  Fixed                     slop,
  146.                                  JustStyleCode             styleRunPosition,
  147.                                  Point                     numer,
  148.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8016, 0x0032, 0xA8B5);
  149.  
  150. EXTERN_API( void )
  151. MeasureJustified                (Ptr                     textPtr,
  152.                                  long                     textLength,
  153.                                  Fixed                     slop,
  154.                                  Ptr                     charLocs,
  155.                                  JustStyleCode             styleRunPosition,
  156.                                  Point                     numer,
  157.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x801A, 0x0034, 0xA8B5);
  158.  
  159. EXTERN_API( Fixed )
  160. PortionLine                        (Ptr                     textPtr,
  161.                                  long                     textLen,
  162.                                  JustStyleCode             styleRunPosition,
  163.                                  Point                     numer,
  164.                                  Point                     denom)                                FOURWORDINLINE(0x2F3C, 0x8412, 0x0036, 0xA8B5);
  165.  
  166. EXTERN_API( void )
  167. HiliteText                        (Ptr                     textPtr,
  168.                                  short                     textLength,
  169.                                  short                     firstOffset,
  170.                                  short                     secondOffset,
  171.                                  OffsetTable             offsets)                            FOURWORDINLINE(0x2F3C, 0x800E, 0x001C, 0xA8B5);
  172.  
  173. EXTERN_API( void )
  174. DrawJust                        (Ptr                     textPtr,
  175.                                  short                     textLength,
  176.                                  short                     slop)                                FOURWORDINLINE(0x2F3C, 0x8008, 0x001E, 0xA8B5);
  177.  
  178. EXTERN_API( void )
  179. MeasureJust                        (Ptr                     textPtr,
  180.                                  short                     textLength,
  181.                                  short                     slop,
  182.                                  Ptr                     charLocs)                            FOURWORDINLINE(0x2F3C, 0x800C, 0x0020, 0xA8B5);
  183.  
  184. EXTERN_API( Fixed )
  185. PortionText                        (Ptr                     textPtr,
  186.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0024, 0xA8B5);
  187.  
  188. EXTERN_API( long )
  189. VisibleLength                    (Ptr                     textPtr,
  190.                                  long                     textLength)                            FOURWORDINLINE(0x2F3C, 0x8408, 0x0028, 0xA8B5);
  191.  
  192. EXTERN_API( void )
  193. GetFormatOrder                    (FormatOrderPtr         ordering,
  194.                                  short                     firstFormat,
  195.                                  short                     lastFormat,
  196.                                  Boolean                 lineRight,
  197.                                  StyleRunDirectionUPP     rlDirProc,
  198.                                  Ptr                     dirParam)                            FOURWORDINLINE(0x2F3C, 0x8012, 0xFFFC, 0xA8B5);
  199.  
  200.  
  201.  
  202. EXTERN_API( void )
  203. TextFont                        (short                     font)                                ONEWORDINLINE(0xA887);
  204.  
  205. EXTERN_API( void )
  206. TextFace                        (StyleParameter         face)                                ONEWORDINLINE(0xA888);
  207.  
  208. EXTERN_API( void )
  209. TextMode                        (short                     mode)                                ONEWORDINLINE(0xA889);
  210.  
  211. EXTERN_API( void )
  212. TextSize                        (short                     size)                                ONEWORDINLINE(0xA88A);
  213.  
  214. EXTERN_API( void )
  215. SpaceExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xA88E);
  216.  
  217. EXTERN_API( void )
  218. DrawChar                        (CharParameter             ch)                                    ONEWORDINLINE(0xA883);
  219.  
  220. EXTERN_API( void )
  221. DrawString                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA884);
  222.  
  223. #if TARGET_OS_MAC
  224.     #define MacDrawText DrawText
  225. #endif
  226. EXTERN_API( void )
  227. MacDrawText                        (const void *            textBuf,
  228.                                  short                     firstByte,
  229.                                  short                     byteCount)                            ONEWORDINLINE(0xA885);
  230.  
  231. EXTERN_API( short )
  232. CharWidth                        (CharParameter             ch)                                    ONEWORDINLINE(0xA88D);
  233.  
  234. EXTERN_API( short )
  235. StringWidth                        (ConstStr255Param         s)                                    ONEWORDINLINE(0xA88C);
  236.  
  237. EXTERN_API( short )
  238. TextWidth                        (const void *            textBuf,
  239.                                  short                     firstByte,
  240.                                  short                     byteCount)                            ONEWORDINLINE(0xA886);
  241.  
  242. EXTERN_API( void )
  243. MeasureText                        (short                     count,
  244.                                  const void *            textAddr,
  245.                                  void *                    charLocs)                            ONEWORDINLINE(0xA837);
  246.  
  247. EXTERN_API( void )
  248. GetFontInfo                        (FontInfo *                info)                                ONEWORDINLINE(0xA88B);
  249.  
  250. EXTERN_API( void )
  251. CharExtra                        (Fixed                     extra)                                ONEWORDINLINE(0xAA23);
  252.  
  253. EXTERN_API( void )
  254. StdText                            (short                     count,
  255.                                  const void *            textAddr,
  256.                                  Point                     numer,
  257.                                  Point                     denom)                                ONEWORDINLINE(0xA882);
  258.  
  259. EXTERN_API( short )
  260. StdTxMeas                        (short                     byteCount,
  261.                                  const void *            textAddr,
  262.                                  Point *                numer,
  263.                                  Point *                denom,
  264.                                  FontInfo *                info)                                ONEWORDINLINE(0xA8ED);
  265.  
  266.  
  267. #if CGLUESUPPORTED
  268. EXTERN_API_C( void )
  269. drawstring                        (const char *            s);
  270.  
  271. EXTERN_API_C( short )
  272. stringwidth                        (const char *            s);
  273.  
  274. EXTERN_API_C( void )
  275. stdtext                            (short                     count,
  276.                                  const void *            textAddr,
  277.                                  const Point *            numer,
  278.                                  const Point *            denom);
  279.  
  280. #endif  /* CGLUESUPPORTED */
  281.  
  282. #if OLDROUTINENAMES
  283. #define NPixel2Char(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) \
  284.     PixelToChar(textBuf, textLen, slop, pixelWidth, leadingEdge, widthRemaining, styleRunPosition, numer, denom) 
  285. #define NChar2Pixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom) \
  286.     CharToPixel(textBuf, textLen, slop, offset, direction, styleRunPosition, numer, denom)
  287. #define NDrawJust(textPtr, textLength, slop, styleRunPosition, numer, denom) \
  288.     DrawJustified(textPtr, textLength, slop, styleRunPosition, numer, denom)
  289. #define NMeasureJust(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom) \
  290.     MeasureJustified(textPtr, textLength, slop, charLocs, styleRunPosition, numer, denom)
  291. #define NPortionText(textPtr, textLen, styleRunPosition, numer, denom)\
  292.     PortionLine(textPtr, textLen, styleRunPosition, numer, denom)
  293. #endif  /* OLDROUTINENAMES */
  294.  
  295.  
  296. #if PRAGMA_STRUCT_ALIGN
  297.     #pragma options align=reset
  298. #elif PRAGMA_STRUCT_PACKPUSH
  299.     #pragma pack(pop)
  300. #elif PRAGMA_STRUCT_PACK
  301.     #pragma pack()
  302. #endif
  303.  
  304. #ifdef PRAGMA_IMPORT_OFF
  305. #pragma import off
  306. #elif PRAGMA_IMPORT
  307. #pragma import reset
  308. #endif
  309.  
  310. #ifdef __cplusplus
  311. }
  312. #endif
  313.  
  314. #endif /* __QUICKDRAWTEXT__ */
  315.  
  316.